package util.lang.sql;

import java.util.Iterator;
import java.util.LinkedList;

public class SqlFilterStatement extends SqlPartialStatement {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	private String sql;
	private LinkedList<Object> values;
	
	public SqlFilterStatement() {
		sql = "TRUE";
		values = null;
	}
	public SqlFilterStatement(String sql, Object... items) {
		this.sql = sql;
		values = new LinkedList<Object>();
		for (int i = 0; i < items.length; i++) {
			values.add(items[i]);
		}
	}
	public SqlFilterStatement(Iterable<Object> items, String sql) {
		this.sql = sql;
		values = new LinkedList<Object>();
        for (Iterator<Object> i = items.iterator(); i.hasNext();) { 
        	Object eachItem = i.next();
        	values.add(eachItem);
        }
	}
	
	@Override
	public String getSql() {
		return sql;
	}
	
	@Override
	public LinkedList<Object> getValues() {
		return values;
	}
	
	@Override
	public String toString() {
		return this.getSql();
	}
}
